import java.io.IOException;
import java.net.SocketException;
import java.util.HashMap;

public class UDPDicServer extends UDPEchoServer{
    HashMap<String,String> dict = new HashMap<>();
    public UDPDicServer(int port) throws SocketException {
        super(port);

        //初始化词典
        dict.put("小猫","cat");
        dict.put("小狗","dog");
    }

    public String process(String request){

        return dict.getOrDefault(request,"未找到该词条");
    }

    static void main() throws IOException {
        UDPDicServer dicServer = new UDPDicServer(9090);
        dicServer.start();
    }
}
